import getpass

from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome()
driver.get('https://qzone.qq.com/')
wait = WebDriverWait(driver, 10)
# 先切换到页面内嵌的窗口（iframe）中
iframe = driver.find_element_by_id('login_frame')
driver.switch_to.frame(iframe)
# 在iframe中去查找超链接、用户名、密码和登录按钮
anchor = driver.find_element_by_id('switcher_plogin')
anchor.click()
username_input = driver.find_element_by_id('u')
username = input('Username: ')
username_input.send_keys(username)
password_input = driver.find_element_by_id('p')
password = getpass.getpass()
password_input.send_keys(password)
login_button = driver.find_element_by_id('login_button')
login_button.click()
print(driver.get_cookies())
